"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.幽灵Handler = void 0;
const Config_1 = require("../../Config");
const Big_1 = require("../core/Big");
const GameUtils_1 = __importDefault(require("../GameUtils"));
const BaseHandler_1 = require("./BaseHandler");
class 幽灵Handler extends BaseHandler_1.BaseHandler {
    /**
     * 游荡，其实和移动是一个意思，撞死后给对面加一个怯战状态，不管对面有没有护盾
     * @param data
     * @param player
     * @returns
     */
    move(data, player) {
        this.handlerMgr.spendAction(player, Config_1.Config.COST_幽灵_MOVE);
        let startPoint = this.gameMgr.map_point.get(data.start);
        let endPoint = this.gameMgr.map_point.get(data.end);
        let big_start = startPoint.big;
        big_start.actionOnce();
        let big_end = endPoint.big;
        if (big_end != null) {
            big_end.deleteState(Big_1.BigState.HIDE);
            big_end.addState(Big_1.BigState.FEAR);
            big_start.die(player, endPoint.id);
            return;
        }
        startPoint.big = null;
        endPoint.big = big_start;
        big_start.point = endPoint;
        this.gameMgr.sendBroadcast(GameUtils_1.default.getObj("幽灵_游荡", { "start": data.start, "end": data.end }));
    }
}
exports.幽灵Handler = 幽灵Handler;
